package cn.nnxy.zentao.controller;


import cn.nnxy.zentao.domain.Log;
import cn.nnxy.zentao.service.List1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("index")
public class IndexController {
    @Autowired
    private List1 list1;

    @GetMapping("ind")
    public String index(String username,Model model){
        list1.LogUser(username);//记录登录
        List<Log> log =list1.queryLog();
        model.addAttribute("log",log);
       model.addAttribute("s",username);
        return "index";
    }
    @GetMapping("ind2")
    public String index2(Model model){
        String username = list1.queryname();
        List<Log> log =list1.queryLog();
        model.addAttribute("log",log);
        model.addAttribute("s",username);
        return "index";
    }



}
